<?php
header('Content-type:text/html;charset=utf-8');
if(isset($_POST['btn'])):
    $color=$_POST['color'];
    switch ($color):
        case '1':
            $color='#ff0000';
            break;
        case '2':
            $color='#009900';
            break;
        case '3':
            $color='#0000ff';
            break;
    endswitch;
    ?>
    <script type="text/javascript">
        window.onload=function () {
            shi.style.color=<?php echo $color?>;
        }
    </script>
    <?php
endif;
?>
<div id="shi" class="">
    锄禾日当午，<br/>
    汗滴禾下土。<br/>
    谁知盘中餐，<br/>
    粒粒皆幸苦。<br/>
</div>
<form method="post" action="">
    <select name="color">
        <option >--请选择颜色--</option>
        <option value="1">红色</option>
        <option value="2">绿色</option>
        <option value="3">蓝色</option>
    </select><br/>
    <input type="submit" name="btn" value="更改颜色">
</form>

